#include <stdio.h>

int main(){
        int num;
    scanf("%d",&num);
    int target=0;
    scanf("%d",&target);
    int target0=target;
    int a[num-1];
    int i;
    while (num!=1){
        target=(target+num)%num;
        num--;
    }
}